<template>
    <div class="app">
        <Header/>

        <div class="app-main">
            <div class="center">
                <table class="app-form-table">
                <tbody v-if="evaluteList.length">
                  <tr v-for="item in evaluteList" :key="item.id">
                    <th>
                      <table>
                        <tr>
                          <td style="width:9em;">评价编码</td>
                          <td  style="width:15em;">{{ item.evalCode  }}</td>
                          <td style="width:9em;">评价人名称：</td>
                          <td style="width:10em;">{{ item.peopleName }}</td>
                          <td style="width:7em;">评价时间：</td>
                          <td style="width:8em;">{{ item.evalTime | formatDayTime }}</td>
                          
                          <td style="width:9em;">总满意度评分：</td>
                          <td style="width:9em">{{ item.score | scoreHandler }}</td>
                        </tr>
                        <tr>
                          <td>评价来源：</td>
                          <td>{{ item.evalSource | sourceHandler }}</td>
                          <td>评价渠道：</td>
                          <td>{{ item.evalChannel | channelHandler }}</td>
                           <td>评价状态</td>
                          <td>{{ item.status | statusHandler }}</td>
                          <td>评价次数：</td>
                          <td>{{ item.evalNum }}</td>
                         
                        </tr>
                        <tr>
                          <td>评价内容说明：</td>
                          <td colspan="7">
                            <span v-if="item.instructions"> {{item.instructions}}
                            </span>
                            <span v-else>
                                    无
                            </span>
                          </td>
                        </tr>
                        <tr>
                          <td>回复人名称：</td>
                          <td>{{ item.replyName }}</td>
                          <td>审核时间：</td>
                          <td>{{ item.checkTime | formatDayTime }}</td>
                          <td>表扬信</td>
                          <td colspan="3">
                            <table>
                                    <tr>
                                        <th v-for="praiseObj in item.praise" :key="praiseObj.paraisName"> {{ praiseObj.paraisName  }}</th>
                                    </tr>
                            </table>
                          </td>
                        </tr>
                        <tr>
                            <td>
                                评价子项信息
                            </td>
                            <td colspan="7">
                                <table>
                                    <tr v-for="evalua in item.evaluationChildren" :key="evalua.childrenName">
                                        <td style="width:50em;"> {{ evalua.childrenName  }}</td>
                                        <td  style="width:20em;"> {{ evalua.score | scoreHandler }}</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                          <td>回复内容：：</td>
                          <td colspan="7">
                            
                            <span v-if="item.replyContent"> {{item.replyContent}}
                            </span>
                            <span v-else>
                                    无
                            </span>
                            
                            <!--
                            <table>
                                <tbody v-if="item.replyContent.length">
                                    <tr v-for="replyCon in item.replyContent" :key="replyCon.childrenName">
                                        <td> {{ evalua.childrenName  }}</td>
                                    </tr>
                                </tbody>
                                <tbody v-if="!item.replyContent.length">
                                    <tr><td>无</td></tr>
                                </tbody>
                            </table>
                             -->
                          </td>
                        </tr>
                      </table>
                    </th>
                  </tr>
                </tbody>
                 <tbody v-if="!evaluteList.length">
                    <tr>
                        <td colspan="8">暂无评价数据</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="foot-wrap">
            <iframe
                id="data_detail"
                height='218'
                src="http://www.sc.gov.cn/10462/c106307/foot_newer_1200.shtml"
                width="100%" frameborder="0"
                @load="ch"
            ></iframe>
        </div>

    </div>
</template>

<script>
import Header from "@/components/Header";
import { getMailList } from '@/api';
export default {
    
  name: "SurveyResult",
  components: {
     Header,
  },
  data() {
    return {
      objCode: "",
      peopleCode: "",
      busiCode: "",
      evaluteList:[],
      evaluteDetail: {
                    objCode: "",                   
                    score: "",                 
                    id: "",                 
                    evalCode: "",                
                    peopleName: "",                
                    evalTime: "",                  
                    praise: ""
                    
      },
    };
  },
  computed:{
    getUserIdOrName(){
      return this.$store.state.user;
    }
  },

  mounted(){
    this.objCode = this.$route.query.objCode;
    this.peopleCode = this.$route.query.peopleCode;
    this.busiCode = this.$route.query.busiCode;
    this.getDetail();
  },
  methods:{
        
       //获取在线留言详情数据
        getDetail() {
                let url = '/sys/sysMember/getMyEvaluateInfo';
                let params = {
                    objCode: this.objCode,
                    peopleCode: this.peopleCode,
                    busiCode: this.busiCode
                };
                getMailList(url, params).then(res => {
                    if (res.data.Status == 'true') {
                        this.evaluteList = res.data.data || [];
                    }else{
                        this.evaluteList = [];
                    }
                })
        }
  },
  filters: {
    deseHandler: function (str, frontLen, endLen, wildcard) {
      if (!str) {
        return "--";
      } else if (str.length < 9) {
        return str;
      } else {
        var len = str.length - frontLen - endLen;
        var xing = "";
        for (var i = 0; i < len; i++) {
          xing += wildcard;
        }
        return (
          str.substring(0, frontLen) + xing + str.substring(str.length - endLen)
        );
      }
    },

    scoreHandler: function (str) {
            if (!str) {
                return "--";
            } else{
                switch(str)
                {
                case 1:
                    str = "非常不满意";
                    break;
                case 2:
                    str = "不满意";
                    break;
                case 3:
                    str = "基本满意";
                    break;
                case 4:
                    str = "满意";
                    break;
                case 5:
                    str = "非常满意";
                    break;
                default:
                    str = "--";
                }
            }
            return str; 
    },
    

    statusHandler: function (str) {
            if (!str) {
                return "--";
            } else{
                switch(str)
                {
                case "10":
                    str = "待回复";
                    break;
                case "90":
                    str = "已完成";
                    break;
                default:
                    str = "--";
                }
            }
            return str; 
    },

    sourceHandler: function (str) {
            if (!str) {
                return "--";
            } else{
                switch(str)
                {
                case "1":
                    str = "四川政务服务网";
                    break;
                case "2":
                    str = "app";
                    break;
                case "3":
                    str = "厅局系统";
                    break;
                case "4":
                    str = "运行平台";
                    break;
                case "5":
                    str = "垂管部门";
                    break;
                case "8":
                    str = "评价仪";
                    break;
                case "11":
                    str = "公安";
                    break;
                case "12":
                    str = "税务";
                    break;
                case "15":
                    str = "彭山";
                    break;
                case "20":
                    str = "仁寿";
                    break;
                case "21":
                    str = "南江";
                    break;
                case "22":
                    str = "22：工改";
                    break;
                default:
                    str = "--";
                }
            }
            return str; 
    },

    channelHandler: function (str) {
            if (!str) {
                return "--";
            } else{
                switch(str)
                {
                case "1":
                    str = "四川政务服务网";
                    break;
                case "2":
                    str = "app";
                    break;
                case "3":
                    str = "二维码";
                    break;
                case "4":
                    str = "政务终端";
                    break;
                case "5":
                    str = "其他终端";
                    break;
                case "6":
                    str = "热线";
                    break;
                case "7":
                    str = "自动评价";
                    break;
                case "8":
                    str = "评价仪";
                    break;
                case "9":
                    str = "短信";
                    break;
                default:
                    str = "--";
                }
            }
            return str; 
    }

  }
};
</script>

<style scoped>
    .app-main {
        overflow: hidden;
    }

    .app-main .center {
        width: 1200px;
        margin: 20px auto;
        background-color: white;
        padding: 0 20px 25px;
    }

    .hd_survey_title {
        border-bottom: 2px solid #ccc;
        padding-bottom: 20px;
    }

    .hd_survey_title h1 {
        font-size: 36px;
        font-weight: 500;
        padding-top: 30px;
        color: #4c4c4c;
        line-height: 50px;
        text-align: center;
        word-wrap: break-word;
        margin: 20px 0;
    }

    .hd_survey_time {
        margin-top: 12px;
        color: #4c4c4c;
        font-size: 16px;
        line-height: 23px;
        text-align: center;
    }

    .hd_survey_time span {
        margin-right: 20px;
    }

    .item_line{
        line-height: 2;
    }
    .my_line {
        display: inline-block;
        /*vertical-align: middle;*/
    }
    .left_div{
        width: 40%;
    }
    .right_div{
        width: 60%;
    }
    .my_progress{
        width: 300px;
    }

</style>
